package com.huluobo.a2109monthdemo2.net

import com.huluobo.a2109monthdemo2.category.CategoryBeanResult
import com.huluobo.a2109monthdemo2.category.CategoryGoodsListBeanResult
import com.huluobo.a2109monthdemo2.detail.AddToCartBeanResult
import com.huluobo.a2109monthdemo2.detail.DetailBeanResult
import com.huluobo.a2109monthdemo2.home.HomeBannerBeanResult
import com.huluobo.a2109monthdemo2.home.HomeGoodsListBeanResult
import com.huluobo.a2109monthdemo2.home.HomeNavBeanResult
import com.huluobo.a2109monthdemo2.login.UserBeanResult
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *  Created by LC on 2024/2/17.
 */
interface ApiService {
    @POST(Const.URL_LOGIN)
    fun login(@Body body: RequestBody): Observable<UserBeanResult>

    @POST(Const.URL_REGISTER)
    fun register(@Body body: RequestBody): Observable<UserBeanResult>

    @GET(Const.URL_HOME_BANNER)
    fun getHomeBanner(): Observable<HomeBannerBeanResult>

    @GET(Const.URL_HOME_NAV)
    fun getHomeNav(): Observable<HomeNavBeanResult>

    @GET(Const.URL_HOME_GOODS_LIST)
    fun getHomeGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<HomeGoodsListBeanResult>

    @GET(Const.URL_GOODS_DETAIL)
    fun getGoodsDetail(@Query(Const.PARAM_GOODS_ID) goodsId: Int): Observable<DetailBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun addToCart(@Body body: RequestBody): Observable<AddToCartBeanResult>

    @GET(Const.URL_CATEGORY)
    fun getCategory(): Observable<CategoryBeanResult>

    @GET(Const.URL_CATEGORY_GOODS_LIST)
    fun getCategoryGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<CategoryGoodsListBeanResult>
}